<!-- Main content -->
<div class="wrapper">
	<div class="fluid">
		<div class="widget grid12">
			<div class="whead">
				<h6>添加管理员</h6>
				<div class="clear"></div>
			</div>
			
			<form id="admin_form" action="<?php echo BASE_URL;?>admin/add" method="post">
			<div class="formRow">
				<div class="grid3">
					<label>用户名 :</label>
					<input type="text" id="admin_name" name="admin_name" class="validate[required,ajax[checkAdminName]]" />
				</div>
				
				<div class="clear"></div>
			</div>
			<div class="formRow">
				<div class="grid3">
					<label>密码 :</label>
					<input type="password" id="admin_pass" name="admin_pass" class="validate[required]" />
				</div>
				<div class="clear"></div>
			</div>
			<div class="formRow">
				<div class="grid3">
					<label>确认密码 :</label>
					<input type="password" id="confirm_pass" name="confirm_pass" class="validate[required,equals[admin_pass]]" />
				</div>
				<div class="clear"></div>
			</div>
			<div class="formRow">
				<div class="grid3">
					<label>选择权限组 :</label>
					<select name="role_id" class="select">
					<?php foreach ($role_list as $role):?>
						<option value="<?php echo $role['role_id'];?>"><?php echo $role['role_name'];?></option>
					<?php endforeach;?>
					</select>
				</div>
				<div class="clear"></div>
			</div>
			<div class="formRow">
				<input type="submit" value="保存" class="buttonL bBlue formSubmit" />
				<div class="clear"></div>
			</div>
			</form>
		</div>
	</div>
</div>

<?php $this->util->js(array(
	'js/plugins/forms/jquery.validationEngine-zh_CN.js',
	'js/plugins/forms/jquery.validationEngine.js'
));?>
<script type="text/javascript">
$(document).ready(function() {
	$.validationEngineLanguage.allRules.checkAdminName = {
		"url": "/admin/index/p/1/checkAdminName/1",
		"extraData": "",
		"alertTextOk": "* 此用户名可以使用",
		"alertText": "* 此用户名已被其他人使用",
		"alertTextLoad": "* 正在确认用户名是否有其他人使用，请稍等。"
	};
	
	$("#admin_form").validationEngine({
		ajaxFormValidation: true,
		ajaxFormValidationMethod: 'post',
		onBeforeAjaxFormValidation: function() {
			
		},
		onAjaxFormComplete: function(status, obj, result) {
			show_msg(result);
		}
	});
});
</script>